{% extends 'extends/nav_front_all_.html' %}

{% block main %}
<div class="container py-5">
    <div class="row">
        <div class="col-md-12">
            <h1>{{ title }}</h1>

            <div id="posts-container"></div>

        </div>
    </div>
</div>


<script>
    onUrlsReady(urls=>{
        let url='{{ url }}'
        Fetch(url,'get',{},res=>{
            if (res.status==='success'){
                res.data.blogs.forEach(post=>{
                    Element_('posts-container').innerHTML+=
                        front_blog_card(
                            post_url=urls.page.front.blogdetail.replace('0',post.pid),
                            icon_url=post.author_icon_url,
                            title=post.title,
                            username=post.author,
                            datetime=post.time,
                            like=post.get_likes,
                            sort=post.sort
                        )
                })
            }
        })
    })
</script>
{% endblock %}
